package dataset;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import filereaders.Factory;

public class Test {

    public static void main(String args[]) {
        
        Map<String, Double> data = new HashMap<String,Double>();
        data.put("Date", 1.0);
        data.put("Open", 2.0);
        data.put("Close", 3.0);
        DataPoint point = new DataPoint(data);
        System.out.println(point.getX() + " " + point.getY());
        point.changeYoption("Close");
        System.out.println(point.getX() + " " + point.getY());
        Collection<String> list = point.getXoptions();
        System.out.println(list.toString());
        
        Map<String, Double> data2 = new HashMap<String,Double>();
        data2.put("Date", 4.0);
        data2.put("Open", 5.0);
        data2.put("Close", 6.0);
        DataPoint point2 = new DataPoint(data2);
        
        Collection<DataPoint> points = new ArrayList<DataPoint>();
        points.add(point);
        points.add(point2);
        
        DataSet set = new DataSet(points, "Here's the Title");
        
        System.out.println("\nTest for manually making DataPoint and DataSet:\n");
        System.out.println("Title: " + set.getTitle() + "\nAverage X (should be: 2.5): " + set.averageX()
                + "\nAverage Y (4.0): " + set.averageY() + "\nMax X (4.0): " + set.getMaxX()
                + "\nMax Y (5.0): " + set.getMaxY() + "\nMin X (1.0): " + set.getMinX()
                + "\nMin Y (3.0): " + set.getMinY());
        File file = null;
        Factory factory = new Factory();
        DataSet set2 = factory.createDataSet(file);
        
        System.out.println("\n\nTest for using factory to get information:");
        System.out.println("\nTitle: " + set2.getTitle() + "\nAverage X (should be: 2.5): " + set2.averageX()
                + "\nAverage Y (4.0): " + set2.averageY() + "\nMax X (4.0): " + set2.getMaxX()
                + "\nMax Y (5.0): " + set2.getMaxY() + "\nMin X (1.0): " + set2.getMinX()
                + "\nMin Y (3.0): " + set2.getMinY());
    }

}
